import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:排序子序列
 * User: wangxin
 * Date: 2024-09-28
 * Time: 22:00
 */
public class test1 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别

        int n = in.nextInt();
        int[] a = new int[n];
        for(int i = 0;i < n;i++){
            a[i] = in.nextInt();
        }
        int count = 1;
        int flag = 0;
        for(int i= 1;i < n ;i++){

            if((a[i ] - a[i - 1]) < 0){
                if(flag == 0){
                    flag = -1;
                }else if(flag == 1){
                    flag =0;
                    count++;
                }
            }else if((a[i] - a[i-1]) > 0){
                if(flag == 0){
                    flag = 1;
                }else if(flag == -1){
                    flag = 0;
                    count++;
                }
            }

        }
        System.out.println(count);
    }
}
